home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / snpd1292.zip / CURSOR.C < prev    next >
Text File  |  1992-12-26  |  2KB  |  51 lines

  1. /*****************************************************************/
  2. /**   CURSOR()                                                  **/
  3. /**   ARGUMENTS: A char variable identifiny what to do with     **/
  4. /**              the cursor.                                    **/
  5. /**   RETURN: none                                              **/
  6. /**                                                             **/
  7. /**   DESCRIPTION:  This function receives a character which    **/
  8. /**                 tells it to do one of several things.       **/
  9. /**                 Turn the cursor on or off, or save the      **/
  10. /**                 cursor positon, or restore the position.    **/
  11. /**                                                             **/
  12. /**   BY Bill Wilkie, 1988                                      **/
  13. /*****************************************************************/
  14.  
  15. int position;   /* global to hold cursor postion */
  16.  
  17. void cursor(char tmp)
  18. {
  19.    union REGS inregs,outregs;                   /* cpu registers */
  20.     
  21.    switch(tmp)
  22.    {
  23.       case 'h' :                                  /* CURSOR OFF */
  24.                inregs.h.ah = 1;              /* set cursor size */
  25.                inregs.h.ch = 0x20;  /* set bit turns cursor off */
  26.                int86(0x10,&inregs,&outregs);
  27.                break;
  28.  
  29.       case 's' :                      /* SAVE CURSOR POSITION */
  30.                inregs.h.ah = 3; /* read cursor positon and size */
  31.                inregs.h.bh = 0;              /* from page zero */
  32.                int86(0x10,&inregs,&outregs);
  33.                position = outregs.x.dx;       /* store positon */
  34.                break;
  35.  
  36.       case 'r' :                     /* RESTORE CURSOR POSITON */
  37.                inregs.h.ah = 2;         /* set cursor positon */
  38.                inregs.h.bh = 0;              /* on page zero */
  39.                inregs.x.dx = position; /* at this old position */
  40.                int86(0x10,&inregs,&outregs);
  41.                break;
  42.  
  43.       case 'o' :                                   /* CURSOR ON */
  44.                inregs.h.ah = 1;     /* set cursor size */     
  45.                inregs.h.ch = 6;     /* cursor start line */
  46.                inregs.h.cl = 7;     /* cursor end line */
  47.                int86(0x10,&inregs,&outregs);
  48.                break;
  49.     }
  50. }
  51.